import 'dart:convert';
import 'dart:ffi';

import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wanxiang_app/bean/normal_entity.dart';
import 'package:wanxiang_app/bean/sell_bean_entity.dart';
import 'package:wanxiang_app/bean/simple_entity.dart';
import 'package:wanxiang_app/pages/my/goodsList.dart';
import 'package:wanxiang_app/utils/common.dart';
import 'package:wanxiang_app/utils/constant.dart';
import 'package:wanxiang_app/utils/user_util.dart';
import 'package:wanxiang_app/widgets/account_textField2.dart';
import 'package:wanxiang_app/widgets/account_textField3.dart';
import 'package:wanxiang_app/widgets/money_textField.dart';
import 'package:wanxiang_app/widgets/only_one_dialog.dart';
import 'package:wanxiang_app/widgets/sell_dialog.dart';
import '../../bean/category_entity.dart';
import '../../bean/extend_entity.dart';
import '../../bean/game_list_entity.dart';
import '../../bean/goods_detail_entity.dart';
import '../../bean/order_list_entity.dart';
import '../../bean/service_list_entity.dart';
import '../../utils/RegExpUtils.dart';
import '../../utils/encodeUtil.dart';
import '../../utils/network_manager.dart';
import '../../utils/network_url.dart';
import '../../utils/toast_util.dart';
import '../../widgets/account_textField4.dart';
import '../../widgets/myappbar.dart';
import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart';
import 'package:bot_toast/bot_toast.dart';
import '../../widgets/simple_dialog.dart';
import 'package:extended_wrap/extended_wrap.dart';


class SellController extends GetxController{

  String oldGoodsId = '';
  String oldChannelId = '';
  String oldChannelName = '';
  String gTitle = '';
  String status='';
  var fees=''.obs;

  bool isInital = false;
  @override
  void onInit() {
    super.onInit();
    if( Get.arguments!=null){


      Map map = Get.arguments;
      if(map['status']!=null){
        status = map['status'];
      }
      if(map['channel_name'].isNotEmpty){// 从我要卖跳过来
        gTitle = map['title'];
        oldChannelName = map['channel_name'];
        submitInfo['phone_number'] =UserUtil.getUSER()?.mobile;

        _getCategory();
        _getExtend();
      }

      if(map['channel_id'].isNotEmpty){
        oldGoodsId = map['goods_id'];
        oldChannelId = map['channel_id'];
        _getDetail();
      }
    }

  }
  @override
  void onClose() {
    super.onClose();
    BotToast.closeAllLoading();
  }
  late SellBeanData detailData;
  TextEditingController phoneController = TextEditingController();
  TextEditingController descController = TextEditingController();
  TextEditingController titleController = TextEditingController();
  TextEditingController wxController = TextEditingController();
  TextEditingController qqController = TextEditingController();
  TextEditingController accountController = TextEditingController();
  TextEditingController priceController = TextEditingController();
  void _getDetail(){
    DioManager.getInstance().post(ServiceUrl.goodsInfoNew,{
      "channel_id":oldChannelId,
      "goods_id":oldGoodsId,
      "status":status,
    }, (data) async {
      SellBeanEntity bannerEntity = SellBeanEntity.fromJson(jsonDecode(data));
      if(bannerEntity.code!=200){
        ToastUtil.show(bannerEntity.msg);
        return;
      }
      isModify = true;
      detailData = bannerEntity.data;

      submitInfo['channel_name'] = detailData.channelName;
      submitInfo['sell_price'] = detailData.sellPrice;
      submitInfo['category_text'] = detailData.categoryText;
      submitInfo['title'] = detailData.title;
      submitInfo['content'] = detailData.content;
      submitInfo['phone_number'] = detailData.phoneNumber;
      submitInfo['wx_number'] = detailData.wxNumber;
      submitInfo['qq_number'] = detailData.qqNumber;
      submitInfo['account_source'] =detailData.accountSource;
      submitInfo['is_indulge'] = detailData.isIndulge.toString();
      submitInfo['is_bargain'] = detailData.isBargain.toString();
      submitInfo['game_account'] = detailData.gameAccount;
      submitInfo['is_msg'] = detailData.isMsg.toString();
      submitInfo['fields'] = detailData.fields;
      submitInfo['user_id'] = UserUtil.getUSER()?.id.toString();
      submitInfo['img_url'] = detailData.imgUrl;
      submitInfo['goods_id'] = oldGoodsId;

      List st=detailData.categoryText.split(' ');
      print('@@@@@@');
      print(st[0]);
      print('@@@@@@');
      fees.value = detailData.sxPrice.toString();
      phoneController.text = detailData.phoneNumber;
      descController.text = detailData.content;
      titleController.text = detailData.title;
      wxController.text = detailData.wxNumber;
      qqController.text = detailData.qqNumber;
      accountController.text = detailData.gameAccount;
      priceController.text = detailData.sellPrice;

      oldChannelName=  detailData.channelName;
      gTitle = detailData.goodName;

      for(var item in detailData.albums){
        pic.add(item.originalPath);
      }



      for(var item in detailData.category){
        if(item.title == st[0]){
           clickCategory = CategoryData();
           clickCategory?.title = item.title;
           clickCategory?.id = item.id;
           clickCategory?.channelId = item.channelId;
           clickCategory?.parentId = item.parentId;
          break;
        }
      }


      _getCategory();
      _getExtend();
      isInital = true;
      update();
    }, (error) {

      ToastUtil.show(error);
    });
  }


  List<Map> sourceList = [
    {'name':'他站购买','value':'0'},  {'name':'自己注册','value':'1'},  {'name':'淘号阁购买','value':'2'},
  ];
  List<Map> msgList = [
    {'name':'无防沉迷','value':'0'},  {'name':'有防沉迷','value':'1'},
  ];
  List<Map> priceList = [
    {'name':'不接受','value':'0'},  {'name':'接受','value':'1'},
  ];
  List<Map> realList = [
    {'name':'不可二次实名','value':'0'},  {'name':'可二次实名','value':'1'},
  ];
  Map openStatus = {
    'system':false,
    'second':false,
  };
  void _getCategory() {

    submitInfo['channel_name'] = oldChannelName;

    DioManager.getInstance().post(ServiceUrl.queryCategoty, {
      "channel_name": oldChannelName,
      "details_id": '0',
    }, (data) async {
      CategoryEntity bannerEntity = CategoryEntity.fromJson(jsonDecode(data));
      if (bannerEntity.code != 200) {

        ToastUtil.show(bannerEntity.msg);
      } else {
        categoryList = bannerEntity.data;
        if(oldGoodsId.isNotEmpty && isModify){
          // for(var item in categoryList){
          //     if(item.id.toString() == detailData.categoryId){
          //       clickCategory = item;
          //         break;
          //     }
          // }
          _changeArea(clickCategory);
        }else{
          _changeArea(categoryList[0]);
        }
      }
      // update();
    }, (error) {
      ToastUtil.show(error);
    });
  }
   CategoryData? clickCategory;
  List<CategoryData> categoryList = [];
  List<CategoryData> secondCategoryList = [];
   CategoryData? secondClickCategory;
  bool isModify = false;
  void _changeArea(item) {
    BotToast.showLoading();
    clickCategory = item;
    _getSecondCategory();
    update();
  }

  void _getSecondCategory() {
    DioManager.getInstance().post(ServiceUrl.queryCategoty, {
      "channel_name": oldChannelName,
      "details_id": clickCategory?.parentId == 0
          ? clickCategory?.id.toString()
          : clickCategory?.parentId.toString(),
    }, (data) async {
      BotToast.closeAllLoading();
      CategoryEntity bannerEntity = CategoryEntity.fromJson(jsonDecode(data));

      if (bannerEntity.code != 200) {
      } else {

        secondCategoryList = bannerEntity.data;
        if(isModify){
          for(var item in secondCategoryList){
            if(item.id == int.parse(detailData.categoryId)){
              secondClickCategory = item;
              break;
            }
          }
          // secondClickCategory = secondCategoryList[0];
          isModify = false;
        }else{
          secondClickCategory = secondCategoryList[0];
        }

        submitInfo['category_text'] = secondClickCategory?.title;
      }
      update();
    }, (error) {
      BotToast.closeAllLoading();
      ToastUtil.show(error);
    });
  }

  List<ExtendData> extendList = [];
  void _getExtend() {
    DioManager.getInstance().post(ServiceUrl.extendList, {
      "channel_name": oldChannelName,
    }, (data) async {
      ExtendEntity bannerEntity = ExtendEntity.fromJson(jsonDecode(data));
      if (bannerEntity.code != 200) {
      } else {
        extendList = bannerEntity.data;
        for (var element in extendList) {
          element.itemOption = element.itemOption.replaceAll("\r\n", ",");
          List<String> bb = element.itemOption.split(',');
          List<Map> aa = [];
          for (var element2 in bb) {
            List<String> bb = element2.split('|');
            Map map = {'name': bb[0], 'selected': false};
            aa.add(map);
          }
          element.datas = aa;
          openStatus[element.title] = false;
        }
        
        if(oldGoodsId.isNotEmpty){
          List<String> aa =detailData.fields.split('^123|^');
          List<Map> mList = [];
          for(var item in aa){
            if(item.isNotEmpty){
              List<String> bb = item.split(":");
              Map map = {
                'name':bb[0],
                'value':bb[1]
              };
              mList.add(map);
            }
          }

          for(var item in extendList){
            for(var child in mList){
              if(child['name'] == item.name){
                List<String> items = child['value'].split('|');
                for(var itemChild in item.datas){
                  for(var sun in items){
                    if(sun == itemChild['name']){
                      itemChild['selected'] = true;
                    }
                  }
                }
              }
            }
          }
        }
      }
      update();
    }, (error) {
      ToastUtil.show(error);
    });
  }

  List<String> pic = [];
  late BuildContext mContext ;

  Map submitInfo = {
    'channel_name':'',
    'sell_price':'',
    'category_id':'',
    'category_text':'',
    'title':'',
    'content':'',

    'phone_number':'',
    'wx_number':'',
    'qq_number':'',
    'account_source':'-1',
    'is_indulge':'-1',
    'is_bargain':'-1',
    'game_account':'',
    'is_msg':'-1',
    'fields':'',
    'is_self':'-1',
    'user_id':UserUtil.getUSER()?.id.toString(),
    'img_url':'',
    'pic':'',
    'good_id':''
  }.obs;

  // Map submitInfo2 = {
  //   'account_source':'-1',
  //   'is_indulge':'-1',
  //   'is_bargain':'-1',
  //   'is_msg':'-1',
  //   'is_self':'-1',
  // }.obs;

  checkSubmit(){
    if(submitInfo['wx_number'].isEmpty || submitInfo['qq_number'].isEmpty){
      String tip = '';
      if(submitInfo['wx_number'].isEmpty && submitInfo['qq_number'].isEmpty){
        tip = '确定不填写微信、QQ了吗';
      }else  if(submitInfo['wx_number'].isEmpty){
        tip = '确定不填写微信了吗';
      }else  if(submitInfo['qq_number'].isEmpty){
        tip = '确定不填写QQ了吗';
      }
      showDialog(context: mContext, builder: (BuildContext context1) {
        return MySimpleDialog(callBack: (String content) {
          if(content == 'cancel'){
            FocusManager.instance.primaryFocus?.unfocus();
            Navigator.pop(context1);
          }else if(content == 'sure'){
            FocusManager.instance.primaryFocus?.unfocus();
            _submitData();
            Navigator.pop(context1);
          }
        },
          msg: tip,
          sureText: '确定',
        );});
    }else{
      _submitData();
    }
  }

  _submitData() {
    if(submitInfo['channel_name'].isEmpty){
      ToastUtil.show('请选择游戏');
      return;
    }

    if(submitInfo['sell_price'].isEmpty){
      ToastUtil.show('请输入价格');
      return;
    }
    if(clickCategory==null){
        ToastUtil.show('请选择操作系统');
        return;
    }
    if(secondCategoryList.isNotEmpty){
      if(secondClickCategory==null){
        ToastUtil.show('请选择游戏服务器');
        return;
      }
    }


    // if(submitInfo['category_id'].isEmpty){
    //   ToastUtil.show('请选择操作系统');
    //   return;
    // }
    //
    // if(submitInfo['category_text'].isEmpty){
    //   ToastUtil.show('请选择游戏服务器');
    //   return;
    // }



    if(submitInfo['title'].isEmpty){
      ToastUtil.show('请输入标题描述');
      return;
    }

    if(submitInfo['content'].isEmpty){
      ToastUtil.show('请输入详情介绍');
      return;
    }

    if(submitInfo['phone_number'].isEmpty){
      ToastUtil.show('请输入联系电话');
      return;
    }
    // 'account_source':'-1',
    // 'is_indulge':'-1',
    // 'is_bargain':'-1',
    // 'game_account':'',
    // 'is_msg':'-1',
    // 'fields':'',
    // 'is_self':'-1',

    if(submitInfo['account_source']=='-1'){
      ToastUtil.show('请选择账号来源');
      return;
    }
    if(submitInfo['is_indulge']=='-1'){
      ToastUtil.show('请选择有无防沉迷');
      return;
    }
    if(submitInfo['is_bargain']=='-1'){
      ToastUtil.show('请选择是否接受砍价');
      return;
    }

    if(!RegExpUtils.isPhoneNumber(submitInfo['phone_number'])) {
      print(submitInfo['phone_number']);
      ToastUtil.show('请输入正确电话号码');
      return;
    }
    if(!RegExpUtils.isQQ(submitInfo['qq_number'])) {
      ToastUtil.show('请输入正确QQ');
      return;
    }

    if(submitInfo['game_account'].isEmpty){
      ToastUtil.show('请输入游戏账号');
      return;
    }
    if(submitInfo['is_msg']=='-1'){
      ToastUtil.show('请选择是否可二次实名');
      return;
    }

    if(secondClickCategory!=null){
      submitInfo['category_id'] = '${clickCategory!.id} ${secondClickCategory!.id}';
      submitInfo['category_text'] = '${clickCategory!.title} ${secondClickCategory!.title}';
    }else{
      submitInfo['category_id'] = '${clickCategory!.id}';
      submitInfo['category_text'] = '${clickCategory!.title}';
    }
    String fields = '';
    bool isSuccess = true;
    for(var item in extendList){
      List<String> selectdItem = [];
      for(var item2 in item.datas){
        if(item2['selected']){
          selectdItem.add(item2['name']);
        }
      }
      if(selectdItem.isEmpty &&  item.controlType=='multi-radio'){
        ToastUtil.show('请选择${item.title}');
        isSuccess = false;
        return;
      }
      if(selectdItem.isNotEmpty){
        fields = '$fields${fields.isNotEmpty?'^123|^':''}${item.name}:${selectdItem.join('|')}';
      }

    }
    if(!isSuccess){
      return;
    }

    submitInfo['fields'] = fields;
    if(submitInfo['img_url'].isEmpty){
      ToastUtil.show('请上传封面');
      isSuccess = false;
      return;
    }

    if(pic.isEmpty){
      ToastUtil.show('请上传截图');
      isSuccess = false;
      return;
    }
    submitInfo['pic'] = pic.join(',');
    if(isInital){
      submitInfo['status'] =detailData.status.toString();
    }

    FocusScope.of(mContext).unfocus();
    BotToast.showLoading();
    DioManager.getInstance().post(ServiceUrl.addSellInfo, submitInfo, (data) async {
      BotToast.closeAllLoading();
      SimpleEntity bannerEntity = SimpleEntity.fromJson(jsonDecode(data));
      if(bannerEntity.code==200){
        showDialog(context: mContext, builder:  (BuildContext context1) {
          return MySellDialog(callBack: (value){
            Navigator.pop(context1);
            Get.back();
          });});
      }else{
        ToastUtil.show(bannerEntity.msg);
      }
      update();
    }, (error) {
      ToastUtil.show(error);
    });
  }

  void _cancel(){
    showDialog(context: mContext, builder: (BuildContext context1) {
      return MySimpleDialog(callBack: (String content) {
        if(content == 'cancel'){
          Navigator.pop(context1);
        }else if(content == 'sure'){
          Navigator.pop(context1);
          DioManager.getInstance().post(ServiceUrl.cancelGoods,{
            "channel_id":oldChannelId,
            "goods_id":oldGoodsId
          }, (data) async {
            SimpleEntity bannerEntity = SimpleEntity.fromJson(jsonDecode(data));
            ToastUtil.show(bannerEntity.msg);
            update();
          }, (error) {
            ToastUtil.show(error);
          });

        }
      },
        msg: "是否撤销商品审核？撤销后该商品不再展示",
        sureText: "确定",
      );
    });

  }

  void _upload(base64Str,type) {
     BotToast.showLoading();
    DioManager.getInstance().post(ServiceUrl.uploadImg, {
      "channel_name": oldChannelName,
      "img_src":base64Str,
    }, (data) async {
      BotToast.closeAllLoading();
      SimpleEntity simpleEntity =   SimpleEntity.fromJson(jsonDecode(data));
      if(simpleEntity.code ==200){
        if(type ==0){
          submitInfo['img_url']= simpleEntity.msg;
        }else{
          pic.add( simpleEntity.msg);
        }
      }
      update();
    }, (error) {
      ToastUtil.show(error);
    });
  }


  void _upload2(base64Str,type, {required Null Function(String str) callBack}) {
    BotToast.showLoading();
    DioManager.getInstance().post(ServiceUrl.uploadImg, {
      "channel_name": oldChannelName,
      "img_src":base64Str,
    }, (data) async {
      BotToast.closeAllLoading();
      SimpleEntity simpleEntity =   SimpleEntity.fromJson(jsonDecode(data));
      if(simpleEntity.code ==200){
        if(type ==0){
          submitInfo['img_url']= simpleEntity.msg;
        }else{
          pic.add( simpleEntity.msg);
        }
        callBack('1');
      }
      update();
    }, (error) {
      ToastUtil.show(error);
    });
  }

  uploadImages() async {
    ToastUtil.show("请长按图片多选");
    Future.delayed(Duration(milliseconds: 500), () async {
      final ImagePicker picker = ImagePicker();
      final List<XFile> image = await picker.pickMultiImage();
      digui(0,image);
    });


  }

  digui(index,List<XFile> images ){
    EncodeUtil.image2Base64(images[index].path.toString()).then((data){
      _upload2(data, 1,callBack:(String str){
        if(index!=images.length-1){
          int aa = index+1;
          digui(aa,images);
        }else{
          update();
        }
      });
    });
  }

  void _refresh(){
    DioManager.getInstance().post(ServiceUrl.refreshGoods,{
      "user_name":UserUtil.getUSER()?.userName.toString(),
      "channel_id":oldChannelId,
      "goods_id":oldGoodsId
    }, (data) async {
      SimpleEntity bannerEntity = SimpleEntity.fromJson(jsonDecode(data));
      ToastUtil.show(bannerEntity.msg);
      update();
    }, (error) {
      ToastUtil.show(error);
    });
  }

  void _off(){
    DioManager.getInstance().post(ServiceUrl.offGoods,{
      "channel_id":oldChannelId,
      "goods_id":oldGoodsId
    }, (data) async {
      SimpleEntity bannerEntity = SimpleEntity.fromJson(jsonDecode(data));
      ToastUtil.show(bannerEntity.msg);
      update();
    }, (error) {
      ToastUtil.show(error);
    });
  }



}


class SellPage extends GetView<SellController>  {
  late SellController controller ;
  late BuildContext context ;
  @override
  Widget build(BuildContext context1) {
    Get.lazyPut<SellController>(() => SellController());
    controller = Get.find();
    context = context1;
    controller.mContext = context1;
    return GetBuilder<SellController>(

      builder: (_){
        return  Scaffold(
            appBar: MyAppBar(context: context, title: controller.isInital?Common.statusToText(int.parse(controller.detailData.status) ) :'填写信息',hasLeading: true,),
            backgroundColor: Color(0xFFF7F8FC),
            body:controller.isInital || controller.oldChannelName.isNotEmpty? _content():Container());
      },
    );
  }
  Widget _content(){
    return SingleChildScrollView(
        child: Container(
          padding: EdgeInsets.all(10.w),
          child: Column(
            children: [
              // controller.isInital && controller.detailData.status ==0?
              // _type('商品信息'):Container(),
              // controller.isInital && controller.detailData.status ==0?
              // _checkInfo():Container(),

              _type('填写信息'),
              _textItem('当前游戏',true,false,controller.gTitle),
              _textItem('出售价格',true,true,''),

              controller.isInital && controller.detailData.status =='0'?
              Row(
                children: [
                  IconButton(
                      icon: Icon(Icons.warning,color: Color(0xFFF43F50),),
                      onPressed: () {
                      }),
                  Expanded(child: Text('出售价格不等于到手价格,平台将扣除5%的手续费(最低50元)',style: TextStyle(color: Color(0xFFF43F50),fontSize: 12.sp)),)
                ],
              ):Container(),

                  Obx(() => controller.fees.value.isNotEmpty? Container(
                      margin: EdgeInsets.only(top: 5.h,left: 15.w),
                      alignment: Alignment.centerLeft,
                      child:  Text(
                        '代售费用(费率5%)  ¥${double.parse(controller.fees.value).toStringAsFixed(2)}',
                        style: TextStyle(color: Color(0xFFF43F50),fontSize: 12.sp),
                      )
                  )     :Container())

              ,
              // Text('代售费用(费率5%)  ¥'+ controller.fees.value,key:Key('fees')),
              _system(),
              controller.secondCategoryList.isNotEmpty?
              _secondSystem():Container(),
              _titleInfo(),
              _descInfo(),
              _phonesInfo(),
              _source(),
              _msg(),
              _price(),
              _type('账号信息'),
              _textItem('游戏账号',true,true,''),
              _real(),
              Column(
                children: _filterExtends(),
              ),
              _uploadFirst(),
              _uploadPic(),
              controller.isInital ?_checkStatus(controller.detailData.status):
              _submit()
            ],
          ),
        )
    ) ;
  }

  Widget _checkInfo(){
    return Container(
      margin: EdgeInsets.only(top: 6.h,bottom: 15.h),
      padding: EdgeInsets.all(10.w),
      width: Get.width - 30.w,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(6.r)
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text("1.商品编号：${controller.detailData.id.toString()}"),
          SizedBox(height: 15.h,),
          Text("2.提交时间：${Common.transferDate(controller.detailData.addTime)}"),
          SizedBox(height: 15.h,),
          Row(
            children: [
              const Text("3.审核状态："),
              Text(Common.statusToText(int.parse(controller.detailData.status)),style: const TextStyle(
                color: Color(0xFFF43F50)
              ))
            ],
          )

          
        ],
      ),
    );
  }


  Widget _type(text){
    return Container(
      margin: EdgeInsets.only(top: 10.h),
      child:  Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Container(
            width: 4.w,
            height: 16.h,
            color: const Color(0xFF007BE5),
          ),
          SizedBox(width: 8.w,),
          Text(text,style: const TextStyle(
              color: Color(0xFF333333),
              fontWeight: FontWeight.bold
          ),)
        ],
      )
    );
  }

  Widget _system(){
    return Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          _title('操作系统',true),
          SizedBox(height: 8.h,),

          ExtendedWrap(
            maxLines:  controller.openStatus['system']?100:2,
            minLines: 2,
            runSpacing: 12,
            spacing: 12,
            alignment: WrapAlignment.start,
            children: controller.categoryList
                .map((item) => _itemArea(item,controller.clickCategory?.id,0))
                .toList(),
            overflowWidget: _expand('system',false),
          ),

          // Wrap(
          //     spacing: 15,
          //     children: controller.categoryList
          //         .map((item) => _itemArea(item))
          //         .toList()),
        ],
      ),
    );
  }

  Widget _expand(title,ismult){
    return InkWell(
      onTap: (){
        controller.openStatus[title] = !controller.openStatus[title];
        controller.update();
      },
      child: Container(
          height: 40.h,
          width: 40.w,
          alignment: Alignment.center,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              Text( controller.openStatus[title]?'折起':'展开',style: TextStyle(
                  fontSize: 13.sp,
                  color: Color(0xFF666666)
              ),),
              Image.asset(Constant.IMG_BASE+'expand.png',width: 7.w,height: 7.h,)
            ],
          )
      )
    )  ;
  }

  Widget _secondSystem(){
    return Container(
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          _title(controller.clickCategory==null?'游戏服务器':controller.clickCategory!.title+'服务器',true),
          SizedBox(height: 8.h,),

          ExtendedWrap(
            maxLines: controller.openStatus['second']?100:2,
            minLines: 2,
            runSpacing: 12,
            spacing: 12,
            alignment: WrapAlignment.start,
            overflowWidget: _expand('second',false),
            children: controller.secondCategoryList
                .map((item) => _itemArea(item,controller.secondClickCategory?.id,1))
                .toList(),
          ),

        ],
      ),
    );
  }

  Widget _titleInfo(){
    return Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          _title('标题描述',true),
          SizedBox(height: 8.h,),
          AccountEdit4Text(key: ValueKey('_titleInfo'),
            defaultText: controller.titleController.text,
            maxLines: 3, contentStrCallBack: (value){
            controller.submitInfo['title'] = value;
          }, controller: controller.titleController,)
        ],
      ),
    );
  }

  Widget _descInfo(){
    return Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          _title('详情介绍',true),
          SizedBox(height: 8.h,),
          AccountEdit4Text(key: ValueKey('_descInfo'),maxLines: 3,
            defaultText: controller.submitInfo['content'],
            contentStrCallBack: (value){
            controller.submitInfo['content'] = value;
          }, controller: controller.descController,)
        ],
      ),
    );
  }

  Widget _phonesInfo(){

    // controller.phoneController.text = UserUtil.getUSER()!.mobile;
    return Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  Text('联系电话',style: TextStyle(color: Color(0xFF333333),fontSize: 13.sp),),
                  const Text("*",style: TextStyle(
                      color: Color(0xFFF43F50)
                  ),),
                ],
              ),

              Container(
                width: 180.w,
                alignment: Alignment.centerRight,
                  child: AccountEdit4Text(
                      key: ValueKey('phone'),defaultText: controller.submitInfo['phone_number'],textAlign: TextAlign.right,
                    contentStrCallBack: (content){
                        controller.submitInfo['phone_number'] = content;
                  }, controller: controller.phoneController,)
              )

            ],
          ),

          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  Text('联系微信',style: TextStyle(color: Color(0xFF333333),fontSize: 13.sp),),
                ],
              ),

              Flexible(
                  child: AccountEdit4Text(
                      textAlign: TextAlign.right,
                    defaultText: controller.submitInfo['wx_number'],
                      key: ValueKey('wx_number'), contentStrCallBack: (content){
                    controller.submitInfo['wx_number'] = content;
                  }, controller: controller.wxController,)
              )

            ],
          ),

          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  Text('联系QQ',style: TextStyle(color: Color(0xFF333333),fontSize: 13.sp),),
                ],
              ),

              Flexible(
                  child: AccountEdit4Text(
                    defaultText: controller.submitInfo['qq_number'],
                      textAlign: TextAlign.right,
                      key: ValueKey('qq_number'), contentStrCallBack: (content){
                    controller.submitInfo['qq_number'] = content;
                  }, controller: controller.qqController,)
              )

            ],
          ),

        ],
      ),
    );
  }

  Widget _source(){
    return Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            margin: EdgeInsets.only(top: 10.h),
            child:    Row(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Text('账号来源',style: TextStyle(color: Color(0xFF333333),fontSize: 13.sp),),
                const Text("*",style: TextStyle(
                    color: Color(0xFFF43F50)
                ),),
              ],
            ),
          ),

          SizedBox(
              width: 220.w,
              child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children:[
                    Row(
                      children: [
                        _sourceItem(controller.sourceList[0]),
                        _sourceItem(controller.sourceList[1]),
                      ],
                    ),
                    _sourceItem(controller.sourceList[2]),
                  ]
              )
          )

        ],
      ),
    );
  }

  Widget _sourceItem(map){

    return Obx(() => Container(
        child: Row(
          children: [
            Radio(
              activeColor: Color(0xFF007BE5),
              value: map['value'],
              groupValue: controller.submitInfo['account_source'],
              onChanged: (v) {
                print('vvvvvvv===='+v);
                controller.submitInfo['account_source'] = v;
                controller.update();
              },
            ),
            Text(map['name']),

          ],
        )
    )) ;
  }


  Widget _msg(){
    return Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            margin: EdgeInsets.only(top: 15.h),
            child:    Row(
              children: [
                Text('有无防沉迷',style: TextStyle(color: Color(0xFF333333),fontSize: 13.sp),),
                const Text("*",style: TextStyle(
                    color: Color(0xFFF43F50)
                ),),
              ],
            ),
          ),

          SizedBox(
              width: 220.w,
              child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children:[
                    Row(
                      children: [
                        _msgItem(controller.msgList[0]),
                        _msgItem(controller.msgList[1]),
                      ],
                    ),
                  ]
              )
          )

        ],
      ),
    );
  }

  Widget _msgItem(map){
    return Obx(() => Container(
        child: Row(
          children: [
            Radio(
              activeColor: Color(0xFF007BE5),
              value: map['value'],
              groupValue: controller.submitInfo['is_indulge'],
              onChanged: (v) {
                if(v=='1'){
                  showDialog(context: context, builder: (BuildContext context1) {
                    return MyOneDialog(callBack: (String content) {
                      Navigator.pop(context1);
                    },
                      msg: '有防沉迷账号，禁止交易!',
                      sureText: '确定',
                    );});

                }
                controller.submitInfo['is_indulge'] = v;

                controller.update();
              },
            ),
            Text(map['name']),

          ],
        )
    )) ;
  }

  Widget _price(){
    return Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            margin: EdgeInsets.only(top: 15.h),
            child:    Row(
              children: [
                Text('是否接受砍价',style: TextStyle(color: Color(0xFF333333),fontSize: 13.sp),),
                const Text("*",style: TextStyle(
                    color: Color(0xFFF43F50)
                ),),
              ],
            ),
          ),

          SizedBox(
              width: 220.w,
              child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children:[
                    Row(
                      children: [
                        _priceItem(controller.priceList[0]),
                        _priceItem(controller.priceList[1]),
                      ],
                    ),
                  ]
              )
          )

        ],
      ),
    );
  }

  Widget _priceItem(map){
    return Obx(() => Container(
        child: Row(
          children: [
            Radio(
              activeColor: Color(0xFF007BE5),
              value: map['value'],
              groupValue: controller.submitInfo['is_bargain'],
              onChanged: (v) {
                controller.submitInfo['is_bargain'] = v;

                controller.update();
              },
            ),
            Text(map['name']),

          ],
        )
    ) );
  }

  Widget _real(){
    return Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            margin: EdgeInsets.only(top: 15.h),
            child:    Row(
              children: [
                Text('是否可二次实名',style: TextStyle(color: Color(0xFF333333),fontSize: 13.sp),),
                const Text("*",style: TextStyle(
                    color: Color(0xFFF43F50)
                ),),
              ],
            ),
          ),

          SizedBox(
              width: 200.w,
              child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children:[
                    Column(
                      children: [
                        _realItem(controller.realList[0]),
                        _realItem(controller.realList[1]),
                      ],
                    ),
                  ]
              )
          )

        ],
      ),
    );
  }

  Widget _realItem(map){
    return Obx(() =>Container(
        child: Row(
          children: [
            Radio(
              activeColor: Color(0xFF007BE5),
              value: map['value'],
              groupValue: controller.submitInfo['is_msg'],
              onChanged: (v) {
                controller.submitInfo['is_msg'] = v;

                controller.update();
              },
            ),
            Text(map['name']),

          ],
        )
    )) ;
  }

  Widget _itemArea(CategoryData item,id,type) {
    return InkWell(
        onTap: () {
          if(type ==0){
            controller._changeArea(item);
          }else{
            controller.secondClickCategory = item;
            controller.update();
          }

        },
        child: RawChip(
          label: Text(
            item.title,
            style: TextStyle(
                color: item.id == id
                    ? const Color(0xFF007BE5)
                    : const Color(0xFF333333),
                fontSize: 13.sp),
          ),
          shape:
          RoundedRectangleBorder(borderRadius: BorderRadius.circular(6.r)),
          backgroundColor: item.id == id
              ? const Color(0xFFEBF6FF)
              : const Color(0xFFF5F5F5),
          padding: const EdgeInsets.symmetric(vertical: 10),
        ));
  }

  Widget _title(text,isNeed){
    return Row(
      children: [
        Text(text,style: TextStyle(fontSize: 13.sp,color: const Color(0xFF333333)),),
        const Text("*",style: TextStyle(
            color: Color(0xFFF43F50)
        ),),
      ],
    );
  }

  Widget _textItem(text,isNeed,isInput,content){
    String defaultText = '';
    if(text=='出售价格'){
      defaultText =  controller.submitInfo['sell_price'];
    }else if(text=='游戏账号'){
      defaultText =  controller.submitInfo['game_account'];
    }

    return  Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.only(left: 12.w,right: 12.w),
      height: 52.h,
      decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(8.r)
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Row(
            children: [
              Text(text,style: TextStyle(color: Color(0xFF333333),fontSize: 13.sp),),
              isNeed? const Text("*",style: TextStyle(
                  color: Color(0xFFF43F50)
              ),):Container(),
            ],
          ),

          text=='出售价格'?
          Container(
              alignment: Alignment.centerRight,
              width: 200.w,
              child:  isInput?MoneyTextField(
                defaultText: defaultText,
                textAlign: TextAlign.right,
                key: ValueKey('key'), contentStrCallBack: (content){

                  controller.submitInfo['sell_price'] = content;
                  if(content.isEmpty){
                    controller.fees.value = '';
                  }else{
                    print('controller.fees.valuecontroller.fees.value===='+content);
                    if((double.parse(content)  * 0.05)<50){
                      controller.fees.value = '50';
                    }else{
                      controller.fees.value = ((double.parse(content)  * 0.05).toStringAsFixed(2) );
                    }


                    print('controller.fees.valuecontroller.fees.value===='+controller.fees.value);
                  }

              },):Text(content)
          ):

          Container(
            alignment: Alignment.centerRight,
            width: 200.w,
              child:  isInput?AccountEdit4Text(
                defaultText: defaultText,
                controller: text=='出售价格'? controller.priceController:controller.accountController,
                  textAlign: TextAlign.right,
                  key: ValueKey('key'), contentStrCallBack: (content){
                if(text=='出售价格'){
                  controller.submitInfo['sell_price'] = content;
                  if(content.isEmpty){
                    controller.fees.value = '';
                  }else{
                    controller.fees.value = ((double.parse(content)  * 0.05).toStringAsFixed(2) );

                  }
                }else if(text=='游戏账号'){
                  controller.submitInfo['game_account'] = content;
                }
              },):Text(content)
          )

        ],
      ),
    );
  }
  Widget _itemArea2(CategoryData item) {
    return InkWell(
        onTap: () {
          controller.secondClickCategory = item;
          controller.update();
        },
        child: RawChip(
          label: Text(
            item.title,
            style: TextStyle(
                color: item.id == controller.secondClickCategory?.id
                    ? const Color(0xFF007BE5)
                    : const Color(0xFF333333),
                fontSize: 13.sp),
          ),
          shape:
          RoundedRectangleBorder(borderRadius: BorderRadius.circular(6.r)),
          backgroundColor: item.id == controller.secondClickCategory?.id
              ? const Color(0xFFEBF6FF)
              : const Color(0xFFF5F5F5),
          padding: const EdgeInsets.symmetric(vertical: 10),
        ));
  }

  List<Widget> _filterExtends() {
    List<Widget> aa = [];
    for (var element in controller.extendList) {
      aa.add(_filterExtend(element.title, element.datas,element));
    }
    return aa;
  }

  Widget _filterExtend(title, List<Map> list,ExtendData elment) {
    return Container(
        margin: EdgeInsets.only(top: 6.h),
        padding: EdgeInsets.all(12.w),
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(8.r),
            color: Colors.white
        ),
        width: MediaQuery.of(context).size.width,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Row(
              children: [
                Text(
                  title,
                  style: TextStyle(fontSize: 13.sp),
                ),
                elment.controlType=='multi-radio'?
                Text(
                  '*',
                  style: TextStyle(fontSize: 13.sp,color: Color(0xFFF43F50)),
                ):Container()
              ],
            )
            ,
            SizedBox(
              height: 5.h,
            ),

            Container(
              child:  ExtendedWrap(
                maxLines: controller.openStatus[title]?100:2,
                minLines: 2,
                spacing: 12,
                overflowWidget: _expand(title,true),
                children: list.map((item) => _itemExtend(item,elment,list)).toList(),

              )
            )
           ,

            // Wrap(
            //     spacing: 15,
            //     children: list.map((item) => _itemExtend(item,elment,list)).toList()),
          ],
        ));
  }

  Widget _itemExtend(Map item,ExtendData elment,list) {
    return InkWell(
        onTap: () {
          if( elment.controlType=='multi-radio'){
            for(var item2 in list){
              item2['selected'] = false;
            }
            item['selected'] = true;
          }else{
            item['selected'] = !item['selected'];
          }
          controller.update();
        },
        child: RawChip(
          label: Text(
            item['name'],
            style: TextStyle(
                color: item['selected']
                    ? const Color(0xFF007BE5)
                    : const Color(0xFF333333),
                fontSize: 13.sp),
          ),
          shape:
          RoundedRectangleBorder(borderRadius: BorderRadius.circular(6.r)),
          backgroundColor: item['selected']
              ? const Color(0xFFEBF6FF)
              : const Color(0xFFF5F5F5),
          padding: const EdgeInsets.symmetric(vertical: 10),
        ));
  }

  Widget _uploadFirst(){
    return Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                '商品封面',
                style: TextStyle(fontSize: 13.sp),
              ),
              Text(
                '*',
                style: TextStyle(fontSize: 13.sp,color: Color(0xFFF43F50)),
              )
            ],
          ),
          SizedBox(height: 10.h,),
          InkWell(
            onTap: () async{
              final ImagePicker picker = ImagePicker();
              final XFile? image = await picker.pickImage(source: ImageSource.gallery);
              EncodeUtil.image2Base64(image!.path.toString()).then((data){
                controller._upload(data,0);
              });

            },
            child: Image.asset(Constant.IMG_BASE+'img_upload.png',width: 62.w,height: 62.w,)
          )
          ,
          controller.submitInfo['img_url'].isEmpty?Container():
          Row(
            children: [
              _selected()
            ],
          )
        ],
      ),
    );
  }

  Widget _selected(){
    return controller.submitInfo['img_url'].isEmpty?Container() :Container(
      margin: EdgeInsets.only(top: 10.h),
      width: 80.w,
      height: 80.w,
      child: Stack(
        children: [
          Container(
              width: 80.w,
              height: 80.w,
            alignment: Alignment.center,
            child: Container(
              width: 70.w,
              height: 70.w,
              child: Image.network(Common.realPicPath(controller.submitInfo['img_url']) ,fit: BoxFit.cover,),
            )
          )
        ,
          Positioned(
              right: 0,
              child: InkWell(
                onTap: (){
                  controller.submitInfo['img_url'] = '';
                  controller.update();
                },
                child:   Image.asset(Constant.IMG_BASE+'img_delete.png',width:16.w ,height: 16.w,))
          )

        ],
      ),
    );
  }



  Widget _uploadPic(){
    return Container(
      margin: EdgeInsets.only(top: 6.h),
      padding: EdgeInsets.all(12.w),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(8.r),
          color: Colors.white
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                '账号截图',
                style: TextStyle(fontSize: 13.sp),
              ),
              Text(
                '*',
                style: TextStyle(fontSize: 13.sp,color: Color(0xFFF43F50)),
              )
            ],
          ),
          SizedBox(height: 10.h,),
          InkWell(
              onTap: () async{

                controller.uploadImages();
              },
              child: Image.asset(Constant.IMG_BASE+'img_upload.png',width: 62.w,height: 62.w,)
          )
          ,
          controller.pic.isEmpty?Container():
          Wrap(
            children: controller.pic.map((item) => _selectedPic(item)).toList(),
          )
        ],
      ),
    );
  }
  Widget _selectedPic(url){
    return Container(
      margin: EdgeInsets.only(top: 10.h),
      width: 70.w,
      height: 70.w,
      child: Stack(
        children: [
          Container(
              width: 70.w,
              height: 70.w,
              alignment: Alignment.center,
              child: Container(
                width: 60.w,
                height: 60.w,
                child: Image.network(Common.realPicPath(url)  ,fit: BoxFit.cover,),
              )
          )
          ,
          Positioned(
              right: 0,
              child: InkWell(
                  onTap: (){
                    controller.pic.remove(url);
                    controller.update();
                  },
                  child: Image.asset(Constant.IMG_BASE+'img_delete.png',width:16.w ,height: 16.w,))
          )

        ],
      ),
    );
  }

  Widget _checking(){
    return Container(
      height: 42.h,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          Expanded(
              flex: 1,
              child: InkWell(
                onTap: (){
                  controller._cancel();
                },
                child:  Container(
                  alignment: Alignment.center,
                  height: 42.h,
                  decoration: BoxDecoration(
                      color: Color(0xff7d87fa),
                      borderRadius: BorderRadius.circular(8.r)
                  ),
                  child: Text('撤销审核',style: TextStyle(
                      color: Colors.white
                  ),),
                )
              ) )
        ,
          SizedBox(width: 10.w,),
          Expanded(
          flex: 1,
        child: InkWell(
          onTap: (){
            controller.checkSubmit();
          },
          child: Container(
            alignment: Alignment.center,
            height: 42.h,
            decoration: BoxDecoration(
                color: Color(0xFF007BE5),
                borderRadius: BorderRadius.circular(8.r)
            ),
            child: Text('重新提交',style: TextStyle(
                color: Colors.white
            ),),
          )
        )
      ),
          SizedBox(width: 10.w,),
          Expanded(
          flex: 1,
        child:   InkWell(
          onTap: (){
            Get.back();
          },
          child: Container(
            alignment: Alignment.center,
            height: 42.h,
            decoration: BoxDecoration(
                color: Color(0xffcbcbcb),
                borderRadius: BorderRadius.circular(8.r)
            ),
            child: Text('返回',style: TextStyle(
                color: Colors.white
            ),),
          )
        )
      ),
        ],
      ),
    );
  }


  Widget _selling(){
    return Container(
      height: 42.h,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          Expanded(
              flex: 1,
              child: InkWell(
                  onTap: (){
                    controller._off();
                  },
                  child:  Container(
                    alignment: Alignment.center,
                    height: 42.h,
                    decoration: BoxDecoration(
                        color: Color(0xfff43f50),
                        borderRadius: BorderRadius.circular(8.r)
                    ),
                    child: Text('下架商品',style: TextStyle(
                        color: Colors.white
                    ),),
                  )
              ) )
          ,
          SizedBox(width: 10.w,),
          Expanded(
              flex: 1,
              child: InkWell(
                  onTap: (){
                    controller.checkSubmit();
                  },
                  child: Container(
                    alignment: Alignment.center,
                    height: 42.h,
                    decoration: BoxDecoration(
                        color: Color(0xFF007BE5),
                        borderRadius: BorderRadius.circular(8.r)
                    ),
                    child: Text('重新提交',style: TextStyle(
                        color: Colors.white
                    ),),
                  )
              )
          ),
          SizedBox(width: 10.w,),
          Expanded(
              flex: 1,
              child:   InkWell(
                  onTap: (){
                    Get.back();
                  },
                  child: Container(
                    alignment: Alignment.center,
                    height: 42.h,
                    decoration: BoxDecoration(
                        color: Color(0xffcbcbcb),
                        borderRadius: BorderRadius.circular(8.r)
                    ),
                    child: Text('返回',style: TextStyle(
                        color: Colors.white
                    ),),
                  )
              )
          ),
        ],
      ),
    );
  }

  Widget _checkStatus(status){
    if(status=='0'){
      return _checking();
    }
    if(status=='22' ||status=='23' ||status=='21'){
      return _forceDown();
    }
    if(status=='1'){
      return _selling();
    }
    return Container();
  }


  Widget _forceDown(){
    return Container(
      height: 42.h,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: [
          SizedBox(width: 10.w,),
          Expanded(
              flex: 1,
              child: InkWell(
                  onTap: (){
                    controller.checkSubmit();
                  },
                  child: Container(
                    alignment: Alignment.center,
                    height: 42.h,
                    decoration: BoxDecoration(
                        color: Color(0xFF007BE5),
                        borderRadius: BorderRadius.circular(8.r)
                    ),
                    child: Text('重新提交',style: TextStyle(
                        color: Colors.white
                    ),),
                  )
              )
          ),
          SizedBox(width: 10.w,),
          Expanded(
              flex: 1,
              child:   InkWell(
                  onTap: (){
                    Get.back();
                  },
                  child: Container(
                    alignment: Alignment.center,
                    height: 42.h,
                    decoration: BoxDecoration(
                        color: Color(0xffcbcbcb),
                        borderRadius: BorderRadius.circular(8.r)
                    ),
                    child: Text('返回',style: TextStyle(
                        color: Colors.white
                    ),),
                  )
              )
          ),
        ],
      ),
    );
  }

  Widget _submit(){
    return InkWell(
        onTap: (){
          controller.checkSubmit();

        },
        child:  Container(
          height: 42.h,
          margin: EdgeInsets.only(top: 40.h,bottom: 46.h),
          alignment: Alignment.center,
          decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(22.r),
              color: Color(0xFF007BE5)
          ),
          child: Text('提交',style: TextStyle(
              color: Colors.white,
              fontSize: 14.sp
          ),),
        )
    );
  }


}